﻿using System.IO;
using Xunit;
using YBBEST.Office365Portal.Core;

namespace YBBEST.Office365Portal.IntegrationTests
{

    public class CopyRepositoryTest
    {
        [Fact]
        public void UploadFile_WithDummyFile_UploadsFile()
        {
            IProxyConfiguration configuration = new MockProxyConfiguration();
            var repo = new CopyRepository(configuration,
                                          new ServiceConnection(configuration, new HttpMessageBuilder(),
                                                                new MsOnlineClaimsHelper(configuration.Username,
                                                                                         configuration.Password,
                                                                                         configuration.SiteUrl)));
            File.WriteAllText("test.txt", "blah blah black sheep");
            using (var stream = File.OpenRead("test.txt"))
            {
                var buffer = new byte[stream.Length];
                stream.Read(buffer, 0, (int) stream.Length);

                repo.UpLoadFile("test.txt", "TestDocumentSetLib" , buffer);

            }
        }
    }
}